# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=glade

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.18.1
pkgrel=1
pkgdesc="User interface builder for GTK+ and GNOME (mingw-w64)"
arch=('any')
url="http://glade.gnome.org"
license=("GPL" "LGPL")
options=('strip' '!debug' 'staticlibs')
depends=(
    "${MINGW_PACKAGE_PREFIX}-gtk3"
    "${MINGW_PACKAGE_PREFIX}-libxml2"
    "${MINGW_PACKAGE_PREFIX}-hicolor-icon-theme"
    )
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
    "${MINGW_PACKAGE_PREFIX}-pkg-config"
    "${MINGW_PACKAGE_PREFIX}-gtk-doc"
    "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
    "${MINGW_PACKAGE_PREFIX}-python2-gobject2"
    'intltool'
    'itstool' 
    'docbook-xsl')
optdepends=("${MINGW_PACKAGE_PREFIX}-python2: Python widgets support"
            #'devhelp: help browser'
      )
url="http://glade.gnome.org/"
install=glade-${CARCH}.install
source=(http://ftp.gnome.org/pub/GNOME/sources/${_realname}/${pkgver%.*}/${_realname}-$pkgver.tar.xz
    0004-give-cc-to-gir-scanner.all.patch
    0005-give-gtk-cflags-to-gir.patch
    0006-disable-gnome-help.patch
    0007-glade-3.16.1-no-undefined.patch)
md5sums=('3c61ab3df62de850f1ff676ef34c6ed1'
         'fb4d5a33bbfea33b6437c85a9ac567c8'
         '294197385457bdc58905a32b6d0e9e1e'
         '3ebefeb0d48ff89f7992e5046ce9f09c'
         '15aa17f408e551a19a5419d6db51a58a')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -p1 -i ${srcdir}/0004-give-cc-to-gir-scanner.all.patch
  patch -p1 -i ${srcdir}/0005-give-gtk-cflags-to-gir.patch
  patch -p1 -i ${srcdir}/0006-disable-gnome-help.patch
  patch -p1 -i ${srcdir}/0007-glade-3.16.1-no-undefined.patch
  autoreconf -fi
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  export PYTHON=${MINGW_PREFIX}/bin/python2
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --disable-static \
    --enable-introspection \
    --enable-shared \
    --disable-gtk-doc \
    --enable-gladeui \
    --disable-man-pages

  make VERBOSE=1
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make -j1 DESTDIR="$pkgdir" install

  mv ${pkgdir}${MINGW_PREFIX}/lib/locale ${pkgdir}${MINGW_PREFIX}/share/
}
